fix(QueryBuilder): Restrict identifier length to 30 characters due to Oracle limitations#48361
Conversation
… Oracle limitations Signed-off-by: provokateurin <[email protected]>
|
/backport to stable30 |
|
/backport to stable29 |
|
/backport to stable28 |
come-nc
left a comment
There was a problem hiding this comment.
This does not fix the bug but ensures it crashes on all DB, right?
Is there no way to magically fix the query instead, ideally in a class specific to OCI? I see we have Adapter, ExpressionBuilder and FuncitonBuilder specifc to OCI.
If we keep this as-is, what would the fix look like in the calling method?
It doesn't crash, it just logs an error. It will fail on Oracle when the query is executed eventually.
I don't think we can magically fix this as the code receiving the results relies on the exact names.
The aliases just need to be shorter. For example Circles adds a ton of prefixes to the name so I think for that case we could maybe drop some of them. |
come-nc
left a comment
There was a problem hiding this comment.
Okay I missed that the Exception is not thrown but only logged.
We do this already: server/lib/private/DB/MigrationService.php Lines 528 to 550 in 9836e9b |
Summary
According to https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html we still support Oracle versions <12.2.
https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/Database-Object-Names-and-Qualifiers.html says:
If COMPATIBLE is set to a value of 12.2 or higher, then names must be from 1 to 128 bytes longandIf COMPATIBLE is set to a value lower than 12.2, then names must be from 1 to 30 bytes long.This means we must prevent any identifier with more than 30 characters as long as we support Oracle <12.2.
This check should also be extended to table names and schema names, but I'm not sure how to do that best.
I found this due to https://github.com/nextcloud/groupfolders/actions/runs/10960223441/job/30434816204 (which tests against Oracle 11) which triggers this query:
where
hp_cc_wn_on_contact_addressbookis 31 characters.Checklist